package pqt;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTree;
import java.awt.Color;
import javax.swing.JSpinner;
import javax.swing.JList;
import javax.swing.JMenuItem;
import java.awt.Choice;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.List;
import java.awt.Toolkit;

public class testAtributos extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			testAtributos dialog = new testAtributos();
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public testAtributos() {
		setIconImage(Toolkit.getDefaultToolkit().getImage(testAtributos.class.getResource("/img/icono.png")));
		setBounds(100, 100, 700, 463);
		getContentPane().setLayout(null);
		contentPanel.setBounds(0, 0, 1, 392);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel);
		contentPanel.setLayout(null);
		final List lista = new List();
		final List errores = new List();
		JButton btnAdd = new JButton(">>");
		btnAdd.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				//(lista.getSelectedIndex())
				//errores.add(lista.getItem(lista.getSelectedIndex()));
				if(lista.getSelectedIndex()!=-1)
				{
					errores.add(lista.getItem(lista.getSelectedIndex()));
					
				}
			}
		});
		btnAdd.setBounds(326, 108, 68, 23);
		getContentPane().add(btnAdd);
		
		JButton btnRemove = new JButton("<<");
		btnRemove.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(errores.getSelectedIndex()!=-1)
				{
				errores.remove(errores.getItem(errores.getSelectedIndex()));
			
				}
			}
		});
		btnRemove.setBounds(326, 219, 68, 23);
		getContentPane().add(btnRemove);
		
		
		lista.setBounds(10, 69, 251, 259);
		lista.add("Atributo 1");
		lista.add("Atributo 2");
		lista.add("Atributo 3");
		lista.add("Atributo 4");
		lista.add("Atributo 5");
		
		getContentPane().add(lista);
		
		
		errores.setBounds(420, 69, 230, 253);
		getContentPane().add(errores);
	}
}
